package club.calong.sanniu.http.response;

public class Response {

    public final static Integer SUCCESS = 20000;
    public final static Integer FAILURE = 50000;

    public interface Message {
        String VERIFICATION_ERROR = "数据校验失败";
        String REQUEST_ERROR = "请求格式错误";
        String INSERT_OK = "添加成功";
        String UPDATE_OK = "修改成功";
        String INSERT_ERROR = "添加失败";
        String UPDATE_ERROR = "修改失败";
        String DELETE_OK = "删除成功";
        String DELETE_ERROR = "删除失败";
        String UPLOAD_ERROR = "上传失败";
        String SEND_OK = "发送成功";
        String SEND_ERROR = "发送失败";
        String SEND_NOT_ALLOWED = "操作过于频繁";
        String CODE_OK = "验证码通过";
        String CODE_ERROR = "验证码错误";
        String LOGIN_OK = "登录成功";
        String REGISTRY_OK = "注册成功";
        String REGISTRY_ERROR = "注册失败";
        String UPLOAD_OK = "上传成功";
        String LOGOUT_OK = "退出成功";
    }

    Integer code;
    String message;
    Object data;

    public Response () {}

    public Response(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Response(Integer code, String message, Object data){
        this.message=message;
        this.code = code;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Response{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
